package com.sjsu.cloudmanager.client.ui;

import com.extjs.gxt.ui.client.Style;
import com.extjs.gxt.ui.client.binding.FormBinding;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.FormButtonBinding;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.layout.FillLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Created by IntelliJ IDEA.
 * User: ckempaiah
 * Date: 10/10/11
 * Time: 11:40 PM
 * To change this template use File | Settings | File Templates.
 */
public class LabResourceDetailPanel extends LayoutContainer {
    private FormBinding formBinding;
    private FormPanel formPanel;
    @Override
    protected void onRender(Element parent, int index) {
        super.onRender(parent, index);
        setBorders(true);
        FormPanel fp = new FormPanel();

        fp.setLabelWidth(100);
        fp.setHeaderVisible(false);
        fp.setAutoWidth(true);
        fp.setExpanded(true);
        LabelField labelField = new LabelField();
        labelField.setName("machineName");
        labelField.setFieldLabel("Resource Name :");

        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("operatingSystem");
        labelField.setFieldLabel("Platform :");
        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("memory");
        labelField.setFieldLabel("Memory :");
        fp.add(labelField);

        LabelField labName = new LabelField();
        labName.setName("labName");
        labName.setFieldLabel("Lab Name :");
        fp.add(labName);

        labelField = new LabelField();
        labelField.setName("machineCloudId");
        labelField.setFieldLabel("Instance Id :");
        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("publicDns");
        labelField.setFieldLabel("Public DNS :");
        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("imageId");
        labelField.setFieldLabel("Image Id :");
        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("status");
        labelField.setFieldLabel("Status :");
        fp.add(labelField);

        labelField = new LabelField();
        labelField.setName("launchTime");
        labelField.setFieldLabel("Launch Time :");
        fp.add(labelField);
        formPanel = fp;
        formBinding = new FormBinding(fp, true);
        //formBinding.addFieldBinding(labName, );
        formBinding.autoBind();
        add(fp);
    }

    public FormPanel getFormPanel() {
        return formPanel;
    }

    public void setFormPanel(FormPanel formPanel) {
        this.formPanel = formPanel;
    }

    public FormBinding getFormBinding() {

        return formBinding;
    }

    public void setFormBinding(FormBinding formBinding) {
        this.formBinding = formBinding;
    }
}
